package com.china08.yxyapi.api.manage.tec.teaching.lecture.res;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.china08.yxyapi.entity.db.res.YxyResBookContents;
import com.china08.yxyapi.model.YxyApiRespModel;
import com.china08.yxyapi.repository.db.YxyResBookContentsRepository;

import io.swagger.annotations.ApiOperation;

@CrossOrigin
@ResponseBody
@Controller("LectureBookContentController1")
public class LectureBookContentController {

    @Autowired
    private YxyResBookContentsRepository yrbcr;

    @ApiOperation(value = "根据目录ID返回目录名称")
    @RequestMapping(value = "/api_yw/manage/tec/teaching/lecture/resbookcontent/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Object process(HttpServletRequest request, HttpServletResponse response,
            @PathVariable(value = "id") String id) {
        RespModel respModel = new RespModel();
        YxyResBookContents bookContents = yrbcr.findById(id);
        respModel.name = bookContents.getName();
        respModel.setMessage("备授课目资源存成功");
        return respModel;
    }

    protected class RespModel extends YxyApiRespModel {
        public String name;
    }

}
